import mitt from "mitt";
import type { CanvasComponent } from "@/views/lowCode/types";
// 定义事件类型映射
type Events = {
  // 组件值变化事件
  "component-value-change": { field: string; value: any; componentId?: string };
  // 按键事件
  "open-relate": { component: CanvasComponent };
  "open-mutex": { component: CanvasComponent };
  "cancel-mutex": { component: CanvasComponent };
  "cancel-relate": { component: CanvasComponent };
  "copy-component": { component: CanvasComponent };
  "delete-component": { componentId: string };
};

export const EventBus = mitt<Events>();
